<template>
    <!--ASN明细-->
    <div id="AsnDetails">
        <v-details :detailData="data.detailData" :inputConfig="inputConfig" :rules="rules" @pop="setdata"></v-details>
    </div>
</template>

<script>

    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "AsnDetails",
        mixins: [baseMixin],
        props: {
            data: {
                type: Object
            }
        },
        data() {
            return {
                rules: {},
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "select",
                            label: this.$t('bill.invoiceType'),
                            props: "invoice_type",
                            options: this.getOptions("queryinvtype/zh")
                        },
                        {
                            type: "select",
                            label: this.$t('bill.chargeCode'),
                            props: "charge_code",
                            options: this.getOptions("queryChargeAcctDetailCode")
                        },
                        {
                            type: "select",
                            label: this.$t('common.type'),
                            props: "markup_type",
                            options: this.getOptions("codelkup/MARKTYPE")
                        },
                        {
                            type: "input",
                            label: "费用加价项",
                            props: "charge_markup",
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: "加价项费用代码",
                            props: "mk_charge_code",
                            options: this.getOptions("queryChargeAcctDetailCode")
                        },
                        {
                            type: "table",
                            label: this.$t('config.company'),
                            props: "cr_corp",
                            tableConfig: [
                                {
                                    label: this.$t("bill.corpCode"),
                                    prop: "corp_code",
                                    input: "input",
                                },
                                {
                                    label: this.$t('common.desc'),
                                    prop: "corp_name",
                                    input: "input",
                                },
                            ],
                            url: `/queryCorporation/?/${this.$store.state.wms}/`
                        },
                        {
                            type: "table",
                            label: this.$t("config.depart"),
                            props: "cr_dept",
                            tableConfig: [
                                {
                                    label: this.$t("config.departCode"),
                                    prop: "dept_code",
                                    input: "input",
                                },
                                {
                                    label: this.$t('common.desc'),
                                    prop: "dept_name",
                                    input: "input",
                                },
                            ],
                            url: `/queryDepartment/${this.data.detailData.cr_corp}/?/${this.$store.state.wms}`
                        },
                        {
                            type: "table",
                            label: this.$t("config.account"),
                            props: "cr_acct",
                            tableConfig: [
                                {
                                    label: this.$t("config.accountCode"),
                                    prop: "acct_code",
                                    input: "input",
                                },
                                {
                                    label: this.$t('common.desc'),
                                    prop: "acct_name",
                                    input: "input",
                                },
                            ],
                            url: `/queryAccount/${this.data.detailData.cr_corp}/${this.data.detailData.cr_dept}/?/${this.$store.state.wms}`
                        },
                    ]
                ]
            }
        },
        methods: {
            setdata(data, id, close, listId) {
                if (listId == "1" && id == "1") {
                    this.data.detailData.cr_corp = data.corp_code;
                } else if (listId == "1" && id == "2") {
                    this.data.detailData.cr_dept = data.dept_code;
                } else if (listId == "1" && id == "3") {
                    this.data.detailData.cr_acct = data.acct_code;
                }
                close(false);
            }
        },
        mounted() {
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
